export default function request(options) {
    return new Promise((resolve, reject) => {
        // 写异步代码，wx.request 
        wx.request({
            url: options.url,
            method: options.method || 'get',
            timeout: options.timeout || 5000,
            data: options.data || {},
            success: res => {
                resolve(res.data)
            },
            fail: err => {
                reject(err)
            }
        })
    })
}
// import request from "./request.js"
// request({url:"xx.com",method:"get",data:{}}).then().catch()
// let res = await request({url:"xx.com",method:"get",data:{}})